package com.miracle.main.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.miracle.common.util.VectorDrawableUtil;
import com.miracle.main.R;
import com.miracle.main.adapter.viewholder.TimeLineViewHolder;
import com.miracle.main.module.mvp.entity.bean.SecretBean;
import com.miracle.main.module.mvp.entity.bean.TimeLineStatus;

import java.util.ArrayList;

/**
 * com.miracle.main.adapter
 * (c)2018 AIR Times Inc. All rights reserved.
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/7/6 17:22
 * @see com.miracle.main.adapter
 */
public class SecreteAdapter extends RecyclerView.Adapter<TimeLineViewHolder> {

    Context mContext;
    LayoutInflater mLayoutInflater;
    ArrayList<SecretBean> mList;

    public SecreteAdapter(ArrayList<SecretBean> list) {
        mList = list;
    }

    @Override
    public TimeLineViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        mContext = parent.getContext();
        mLayoutInflater = LayoutInflater.from(mContext);
        View view;

        view = mLayoutInflater.inflate(R.layout.cloud_item_timeline, parent, false);

        return new TimeLineViewHolder(view, viewType);
    }

    @Override
    public void onBindViewHolder(TimeLineViewHolder holder, int position) {
        SecretBean timeLineModel = mList.get(position);
        if (!timeLineModel.getmDate().isEmpty()) {
            holder.mDate.setVisibility(View.VISIBLE);
//            holder.mDate.setText(DateTimeUtils.parseDateTime(timeLineModel.getmDate(),
// "yyyy-MM-dd" +
//                    " HH:mm", "hh:mm a, dd-MMM-yyyy"));
            holder.mDate.setText("2018-7-7 18:00:06");
        } else {
            holder.mDate.setVisibility(View.GONE);
        }

        holder.mDate.setVisibility(View.VISIBLE);
//            holder.mDate.setText(DateTimeUtils.parseDateTime(timeLineModel.getmDate(),
// "yyyy-MM-dd" +
//                    " HH:mm", "hh:mm a, dd-MMM-yyyy"));
        holder.mDate.setText("2018-7-7 18:00:06");

//        holder.mMessage.setText(timeLineModel.getmMessage());
        holder.mMessage.setText("我是一条消息");
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }
}
